// 留言墙仓库

import { getBuysAPI, getMyBuysAPI } from "@/api";

import store from "@/store";
const state = {
  buyCards: [],
  myBuyCards: [],
};

const actions = {
  // 获取所有buy片
  async initBuycards({ commit }) {
    let res = await getBuysAPI();
    console.log("111", res);
    if (res.status === 0) {
      commit("INITBUYCARDS", res.data);
    }
  },

  //   获取自己的闲置卡片
  async initMyBuyCards({ commit }) {
    let res = await getMyBuysAPI();

    commit("INITMYBUYCARDS", res.data);
  },
};

const mutations = {
  INITBUYCARDS(state, data) {
    state.buyCards = data;
  },
  INITMYBUYCARDS(state, data) {
    state.myBuyCards = data;
  },
};
const getters = {};
export default {
  state,
  mutations,
  actions,
  getters,
};
